<?php 

namespace Home\Controller;
use Home\Controller\CommonController;
use Think\Upload;	

/**
 *  控制图片上传
 */
class ImageController extends CommonController
{
	
	/**
	 * 编译器的图片上传
	 * @AuthorHTL
	 * @DateTime  2017-07-24T19:39:31+0800
	 * @return    [type]                   [description]
	 */
	public function kindupload()
	{
		$upload = new Upload();// 实例化上传类
	    $upload->maxSize   =     3145728 ;// 设置附件上传大小
	    $upload->exts      =     array('jpg', 'gif', 'png', 'jpeg', 'bmp');// 设置附件上传类型
	    $upload->rootPath  =     './'; // 设置附件上传根目录
	    $upload->savePath  =     "./Uploads/"; // 设置附件上传（子）目录
	    // 上传文件 
	    $info   =   $upload->upload();
	       	// var_dump($info);
	       	// die;
	   
	    if(!$info) {// 上传错误提示错误信息
	    	return showKind(1, "上传失败");

	    }else{// 上传成功

	        foreach ($info as $k => $v) {
	        	$data[] = "/gz31/wenda".trim($v['savepath'], '.'). $v['savename'];
	        }
	        // var_dump($info);
	        // var_dump($data);die;
	        return showKind(0, $data[0]);
	    }
	}
}